﻿<?php 
include_once 'public/DB_Oracle.php';
include_once 'public/page/page.class.php';
$DBsql = new DB_Oracle ();
//查询所以警员
//查询所有的派出所
$sql="select dd.department_index, dd.department_name
		  from dep_department dd
		 order by dd.department_index";
$dedp=$DBsql->fetch_all_array($sql);

$sql="select * from dep_update";
$rows=$DBsql->fetch_all_array($sql);
if(empty($_GET['departmentID'])){
$pageSize = 15;
$total=count($rows)== 0 ? 1 : count($rows);
//第一个0显示数字  第二个1显示概况 第三个显示下拉 第四个显示数字数量
pageft($total, $pageSize, 1, 1, 1, 5);
$displaypg+=$firstcount;
$sql="select *
	  from (select rownum r,t1.license_plate,t.version,TO_CHAR(t.starttime, 'YYYY-MM-DD HH24:MI:SS') stime,TO_CHAR(t.successtime, 'YYYY-MM-DD HH24:MI:SS') etime,t.state from dep_update t,dep_vehicle t1 where t.carid=t1.vehicle_index order by t.id desc) c
	 where c.r > $firstcount
	   and c.r <= $displaypg";
$rows=$DBsql->fetch_all_array($sql);}
else
{
	$depID=$_GET['departmentID'];
			$sql="select dp.vehicle_index from dep_vehicle dp where dp.department_index=$depID";
	$rows=$DBsql->fetch_all_array($sql);
$pageSize = 15;
$total=count($rows)== 0 ? 1 : count($rows);
//第一个0显示数字  第二个1显示概况 第三个显示下拉 第四个显示数字数量
pageft($total, $pageSize, 1, 1, 1, 5);
$displaypg+=$firstcount;
$sql="select *
	  from (select rownum r,t1.license_plate,t.version,TO_CHAR(t.starttime, 'YYYY-MM-DD HH24:MI:SS') stime,TO_CHAR(t.successtime, 'YYYY-MM-DD HH24:MI:SS') etime,t.state from dep_update t,dep_vehicle t1 where t.carid=t1.vehicle_index and t1.department_index=$depID order by t.id desc) c
	 where c.r > $firstcount
	   and c.r <= $displaypg";
$rows=$DBsql->fetch_all_array($sql);
	}
?>
<link href="css/style.css" rel="stylesheet" type="text/css" />
<link href="css/validform.css" rel="stylesheet" type="text/css" />
<link href="public/page/css/css.css" rel="stylesheet" type="text/css" />
<script language="javascript" type="text/javascript" src="js/jquery.js"></script>
<script language="javascript" type="text/javascript" src="js/public.js"></script> 
<script language="javascript">
function department(str){
	var url="up_record.php?"+encodeURI("dep="+str);
	window.location=url;  
	}
document.ondblclick = function(){
	POPdiv('selectLocation');
};
function groupSelect(){
	var policeID=$("#selectID").val();
	$('#departmentID').val(policeID);
	$('#Location').submit();
}
</script>
 
<!--管理列表开始-->
<div class="manageTab" style="margin-top:0px;">
  <table width="100%" border="0" cellspacing="0" cellpadding="0" align="center" class="usrTab">
    <tr>
      <td width="8" height="25"><img src="images/user_01.jpg" height="25" width="8" /></td>
      <td style="background:#3980b2;" valign="middle" height="16" ><div class="use_righgDiv"></div>
        <div class="use_leftDiv">
          <table width="100%" border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td  width="22"><img src="images/311.gif" height="16" width="16" /></td>
              <td align="left"><span class="tdTit">更改记录</span></td>
            </tr>
          </table>
        </div></td>
      <td width="8" height="25"><img src="images/user_02.gif" height="25" width="8" /></td>
    </tr>
    <tr>
      <td style="background:#3980b2;" >&nbsp;</td>
      <td><table width="100%" border="0" cellspacing="1" cellpadding="0" align="center" class="usrList" id="List">
          <tr>
            <td  class="td90b2">车牌号</td>
            <td  class="td90b2">版本号</td>
             <td  class="td90b2">提交更新时间</td>
            <td  class="td90b2">更新时间</td>
             <td  class="td90b2">升级完成时间</td>
          </tr>
          <?php if(count($rows)!=0){
          		foreach ($rows as $ros){
          	?>
	          <tr>
	            <td class="tdfff"><?php echo $ros['LICENSE_PLATE'];?></td>
	            <td class="tdfff"><?php echo $ros['VERSION'];?></td>
	            <td class="tdfff"><?php if($ros['STIME']==''){echo "没有提交更新时间";}else{echo $ros['STIME'];}?></td>
	            <td class="tdfff"><?php if($ros['ETIME']==''){echo "没有升级完毕时间";}else{ echo $ros['ETIME'];}?></td>
	            <td class="tdfff"><?php if($ros['STATE']==0){echo "没有更新";}else{ echo "更新";}?></td>
	          </tr>
          <?php }}else{ echo "<tr><td colspan='5' class='tdfff'><font color='#FF0000'>暂无数据！</font></td></tr>";}?>
          <tr>
            <td colspan="10" class="tdfff">&nbsp;</td>
          </tr>
        </table></td>
      <td style="background:#3980b2;">&nbsp;</td>
    </tr>
    <tr>
      <td height="24" width="8"><img src="images/user_03.gif" height="24" width="8" /></td>
      <td style="background:#3980b2;"><div class="green-black"><?php echo $pagenav;?>
        </div></td>
      <td height="24" width="8"><img src="images/user_04.gif" height="24" width="8" /></td>
    </tr>
  </table>
</div>
<!--管理列表结束-->
<!--弹出层选择派出所开始-->
<div id="selectLocation" class="POPdiv">
	 <div class="POPdiv_top"><a href="javascript:void(null)" onclick="ClosePOPdiv('selectLocation')"><img src="images/ico_close.jpg" alt="关闭" /></a>分组查看</div>
        <div class="POPdiv_content">
        	<form id="Location" action="up_record.php" method="get">
	        	 <table border="0" cellpadding="5" cellspacing="0">
				    <tr>
				      <td width="80"><label for="selectID">选择派出所</label></td>
				      <td>
					  	<select id="selectID" name="selectID" onchange="groupSelect()">
							<option value="">全部</option>
							 <?php 
					          	foreach ($dedp as $row){
					         ?>
					         	<option <?php if(isset($_GET['departmentID'])){if($_GET['departmentID']==$row['DEPARTMENT_INDEX']){echo 'selected=selected';}}?> value="<?php echo $row['DEPARTMENT_INDEX'];?>"><?php echo $row['DEPARTMENT_NAME'];?></option>	
					         <?php
					          	}
					         ?>
						</select>
					  </td>
				      <td><input type="hidden" id="departmentID" name="departmentID" value=""></td>
				    </tr>
				 </table>
			 </form>
		</div>
</div>
<!--弹出层选择派出所结束-->